home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / QUEUETST.PAK / QUEUETST.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  2KB  |  61 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*  QUEUETST.CPP                                                          */
  4. /*                                                                        */
  5. /*  Copyright (c) 1991, 1993 Borland International                        */
  6. /*  All Rights Reserved.                                                  */
  7. /*                                                                        */
  8. /*  TQueue example file                                                   */
  9. /*                                                                        */
  10. /*------------------------------------------------------------------------*/
  11.  
  12. #ifndef __CLASSLIB__TIME_H__
  13. #include "classlib\time.h"
  14. #endif  // __LTIME_H
  15.  
  16. #ifndef __QUEUES_H
  17. #include "classlib\queues.h"
  18. #endif  // __QUEUE_H
  19.  
  20. #ifndef __IOSTREAM_H
  21. #include <iostream.h>
  22. #endif
  23.  
  24. #ifndef __DOS_H
  25. #include <dos.h>
  26. #endif
  27.  
  28. #ifndef __STDLIB_H
  29. #include <stdlib.h>
  30. #endif
  31.  
  32.  
  33. int main()
  34. {
  35.  
  36.     randomize();
  37.     TQueue<TTime> TimeLine;
  38.     cout << "\nSampling";
  39.     for( int i = 0; i < 7; i++ )
  40.         {
  41.         TTime SnapShot;
  42.         TimeLine.Put( SnapShot );
  43.         cout << ".";
  44.         int k = rand();
  45.         for(int j = 0; j < k; ++j )  // Delay loop
  46.             {
  47.             cout << "";
  48.             cout << "";
  49.             cout << "";
  50.             }
  51.         }
  52.     cout << "\nThe timing samples are:\n\n";
  53.     while( !TimeLine.IsEmpty() )
  54.         {
  55.         TTime SampleTime = TimeLine.Get();
  56.         cout << SampleTime << "\n";
  57.         }
  58.  
  59.     return 0;
  60. }
  61.